import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '',
      name: 'home',
      component: Home,
      redirect: '/index',
      meta: {
        title: '',
        keywords: '',
        description: ""
      },
      children: [{
        path: '/index',
        name: 'home',
        component: Home,
        meta: {
          title: '',
          keywords: '',
          description: ""
        },
      }]
    },
    {
      path: '/pay',
      name: 'pay',
      component: function () {
        return import(/* webpackChunkName: "about" */ './views/pay.vue')
      },
    },
    {
      path: '/about',
      name: 'about',
      component: function () {
        return import(/* webpackChunkName: "about" */ './views/About.vue')
      },
      meta: {
        title: '关于-兰舟智能',
        keywords: '关于兰舟智能',
        description: '关于兰舟智能'
      },
      redirect: '/aboutIndex',
      children: [
        {
          path: '/aboutIndex',
          name: "aboutIndex",
          meta: {
            title: '关于我们-兰舟智能',
            keywords: '关于我们兰舟智能',
            description: '关于我们兰舟智能'
          },
          component: function () {
            return import('./views/aboutIndex.vue')
          }
        },
        {
          path: '/contant',
          name: 'contant',
          meta: {
            title: '联系我们-兰舟智能',
            keywords: '联系我们兰舟智能',
            description: '联系我们兰舟智能'
          },
          component: function () {
            return import('./views/contant.vue')
          }
        }, {
          path: '/Join',
          name: 'Join',
          meta: {
            title: '加入我们-兰舟智能',
            keywords: '加入我们兰舟智能',
            description: '加入我们兰舟智能'
          },
          component: function () {
            return import('./views/Join.vue')
          }
        }, {
          path: '/feedback',
          name: 'feedback',
          meta: {
            title: '意见反馈-兰舟智能',
            keywords: '意见反馈兰舟智能',
            description: '意见反馈兰舟智能'
          },
          component: function () {
            return import('./views/feedback.vue')
          }
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      meta: {
        title: '登录-兰舟智能',
        keywords: '登录兰舟智能',
        description: '登录兰舟智能'
      },
      component: function () {
        return import('./views/login.vue')
      }
    },
    {
      path: '/register',
      name: 'register',
      meta: {
        title: '注册-兰舟智能',
        keywords: '注册兰舟智能',
        description: '注册兰舟智能'
      },
      component: function () {
        return import('./views/register.vue')
      }
    }, {
      path: '/videoDetail',
      name: 'videoDetail',
      meta: {
        title: '视频兰舟智能',
        keywords: '视频兰舟智能',
        description: '视频兰舟智能'
      },
      component: function () {
        return import('./views/videoDetail.vue')
      }
    }, {
      path: '/product',
      name: 'product',
      meta: {
        title: '产品-兰舟智能',
        keywords: '产品兰舟智能',
        description: '产品兰舟智能'
      },
      component: function () {
        return import('./views/product.vue')
      }
    },
    {
      path: '/newsDetail',
      name: 'newsDetail',
      meta: {
        title: '新闻详情-兰舟智能',
        keywords: '新闻详情兰舟智能',
        description: '新闻详情兰舟智能'
      },
      component: function () {
        return import('./views/newsDetail')
      }
    }, {
      path: '/news',
      name: 'news',
      redirect: '/newsProduct',
      meta: {
        title: '产品-兰舟智能',
        keywords: '产品兰舟智能',
        description: '产品兰舟智能'
      },
      component: function () {
        return import('./views/news.vue')
      },
      children: [
        {
          path: '/newsProduct',
          name: "newsProduct",
          meta: {
            title: '产品资讯-兰舟智能',
            keywords: '产品资讯兰舟智能',
            description: '产品资讯兰舟智能'
          },
          component: function () {
            return import('./views/newsProduct.vue')
          }
        }, {
          path: '/newsHangye',
          name: "newsHangye",
          meta: {
            title: '行业资讯-兰舟智能',
            keywords: '行业资讯兰舟智能',
            description: '行业资讯兰舟智能'
          },
          component: function () {
            return import('./views/newsHangye.vue')
          }
        }, {
          path: '/newsGloub',
          meta: {
            title: '国际资讯-兰舟智能',
            keywords: '国际资讯兰舟智能',
            description: '国际资讯兰舟智能'
          },
          name: "newsGloub",
          component: function () {
            return import('./views/newsGloub.vue')
          }
        }
      ]
    }, {
      path: '/support',
      name: 'support',
      meta: {
        title: '支持-兰舟智能',
        keywords: '支持兰舟智能',
        description: '支持兰舟智能'
      },
      redirect: '/support',
      component: function () {
        return import('./views/support.vue')
      },
      children: [
        {
          path: '/afterSale',
          name: "afterSale",
          meta: {
            title: '售后政策-兰舟智能',
            keywords: '售后政策兰舟智能',
            description: '售后政策兰舟智能'
          },
          component: function () {
            return import('./views/afterSale.vue')
          }
        }, {
          path: '/supportDown',
          name: "supportDown",
          meta: {
            title: '相关下载-兰舟智能',
            keywords: '相关下载兰舟智能',
            description: '相关下载兰舟智能'
          },
          component: function () {
            return import('./views/supportDown.vue')
          }
        }
      ]
    }, {
      path: '/productDetail',
      name: 'productDetail',
      meta: {
        title: '产品详情-兰舟智能',
        keywords: '产品详情兰舟智能',
        description: '产品详情兰舟智能'
      },
      component: function () {
        return import('./views/productDetail.vue')
      }
    }, {
      path: '/vipcenter',
      name: 'vipcenter',

      component: function () {
        return import('./views/vipcenter.vue')
      },
      children: [
        {
          path: '/personInfo',
          name: '/personInfo',
          component: function () {
            return import('./views/personInfo')
          }
        }, {
          path: '/accountSave',
          name: '/accountSave',
          component: function () {
            return import('./views/accountSave')
          }
        }, {
          path: '/modeyDetail',
          name: '/modeyDetail',
          component: function () {
            return import('./views/modeyDetail')
          }
        }, {
          path: '/collect',
          name: '/collect',
          component: function () {
            return import('./views/collect')
          }
        }, {
          path: '/mineCenter',
          name: 'mineCenter',
          component: function () {
            return import('./views/mineCenter')
          }
        }, {
          path: '/discount',
          name: '/discount',
          component: function () {
            return import('./views/discount')
          }
        }, {
          path: '/address',
          name: '/address',
          component: function () {
            return import('./views/address')
          }
        }
        , {
          path: '/vipcenter/shopcart',
          name: '/vipcenter/shopcart',
          component: function () {
            return import('./views/shopcartInner')
          }
        }
      ]
    },
    {
      path: '/shopcart',
      name: 'shopcart',
      component: function () {
        return import('./views/shopcart.vue')
      }
    }
  ],
  scrollBehavior() { // 解决vue页面之间跳转，页面不是在顶部的问题
    return { x: 0, y: 0 }
  }
})
